package com.gyj.controller;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.gyj.model.Profile;
import com.gyj.service.ProfileService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@RestController
@RequestMapping("/profile")
public class ProfileController {
	@Resource
	private ProfileService profileService;

	@GetMapping
	public List<Profile> findAll() {
		List<Profile> profiles = profileService.getProfileList();
		log.info(profiles.toString());
		return profiles;
	}

	@PostMapping
	public void create() {
		Profile p = new Profile();
		p.setContent("test content");
		p.setTitle("title");
		profileService.save(p);
	}
}
